<layout name="Public/layout"/>

<div class="panel panel-default">
    <div class="panel-heading">
        <h3 class="panel-title">
            抽奖设置
        </h3>
    </div>
    <div class="panel-body">
        <form role="form" action="{:U('Home/Index/lottery')}" method="post" id="lotterySetForm">
            <div class="form-group">
                <label for="name">中奖名额</label>
                <input type="text" class="form-control" id="lotteryNum" name="lotteryNum">
            </div>
            <button type="button" class="btn btn-default" id="lotterySub">去抽奖</button>
        </form>
    </div>
</div>

<script>


    $("#lotterySub").click(function(){

        if($("#lotteryNum").val() == ''){
            alert("中奖名额不能为空");
        }
        else if(!checkPositiveNumber($("#lotteryNum").val())){
            alert("中奖名额必须是大于0的整数");
        }else{
            $("#lotterySetForm").submit();
        }
    });
</script>